<template>
  <div class="dingdan">
    <van-nav-bar
      title="订单页面"
      left-text="返回"
      left-arrow
      fixed
      @click-left="$router.back()"
    />
    <!-- 背景 -->
    <div class="asyyds" v-if="info.address && info.address.address">
      <div class="a">
        <div>名字 :</div>
        <div>默认</div>
      </div>
      <div class="b">
        <div>电话 :</div>
        <div>地址 :</div>
      </div>
      <div class="c">
        <van-icon @click="$router.push('/dizhi')" name="arrow" />
      </div>
    </div>
    <div class="bsyyds" v-else>
      <div class="a">
        <div>名字 :</div>
        <div>默认</div>
      </div>
      <div class="b">
        <div>电话 :</div>
        <div>地址 :</div>
      </div>
      <div class="c">
        <van-icon @click="$router.push('/dizhi')" name="arrow" />
      </div>
    </div>
    <!-- 订单相关信息 -->
    <div class="csyyds">
      <div class="item">
        <div>商品合计</div>
        <div>￥{{ info.allPrise }}</div>
      </div>
      <div class="item">
        <div>运费</div>
        <div>免费包邮</div>
      </div>
      <div class="item">
        <div>优惠卷</div>
        <div>暂无</div>
      </div>
    </div>
    <!-- 订单展示 -->
    <div class="dsyyds">
      <ul v-if="info.goodsList">
        <li v-for="item in info.goodsList" :key="item.id">
          <img :src="item.list_pic_url" alt="" />
          <div class="title">
            <div class="a">{{ item.goods_name }}</div>
            <div class="b">{{ item.retail_price }}</div>
          </div>
          <div class="num">{{ item.number }}</div>
        </li>
      </ul>
    </div>
    <!-- 支付按钮 -->
    <div class="fuqian">
      <div class="shifu">实付 : ￥ {{ info.allPrise }}</div>
      <div class="zhifu">支 付</div>
    </div>
  </div>
</template>

<script>
import { detailAction } from "@/api/下单订单页面/dingdan.js";
export default {
  name: "Dingdan",
  data() {
    return {
      info: {},
    };
  },
  created() {
    detailAction({
      params: {
        openId: localStorage.getItem("openId"),
      },
    }).then((res) => {
      console.log(res);
      this.info = res.data;
      console.log(res.data);
    });
  },
};
</script>

<style lang="less" scoped>
.dingdan {
  // 地址
  .asyyds,
  .bsyyds {
    margin-top: 50px;
    width: 100%;
    height: 106px;
    padding: 15px 0;
    box-sizing: border-box;
    background: url(../../../assets/images/address-bg-bd.png) repeat-x;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    .a {
      flex: 1;
      padding-left: 15px;
    }
    .b {
      flex: 3;
      padding-left: 15px;
    }
    .c {
      flex: 1;
      padding-left: 15px;
    }
  }
  // 订单相关信息
  .csyyds {
    width: 100%;
    box-sizing: border-box;
    padding: 0 20px;
    margin: 15px 0;
    .item {
      margin: 10px 0 15px;
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
    }
  }
  // 订单展示
  .dsyyds {
    ul {
      list-style: none;
      li {
        display: flex;
        img {
          flex: 1;
          width: 63px;
          height: 63px;
        }
        .title {
          flex: 3;
        }
        .num {
          flex: 1;
        }
      }
    }
  }
  // 支付
  .fuqian {
    position: fixed;
    bottom: 0;
    left: 0;
    height: 50px;
    width: 100%;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    .shifu {
      padding-left: 20px;
      font-size: 15px;
      color: red;
    }
    .zhifu {
      width: 20%;
      height: 100%;
      text-align: center;
      line-height: 50px;
      color: #fff;
      font-size: 20px;
      background-color: rgb(167, 20, 20);
    }
  }
}
</style>